//
//  AppPublic.h
//  SmartTeaching
//
//  Created by yangqingluo on 15/9/21.
//  Copyright © 2015年 yangqingluo. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import "MainSlideVC.h"
#import "UFType.h"

#define UF_Router_Event_ProductDetailButton           @"UF_Router_Event_ProductDetailButton"
#define UF_Router_Event_AddressSelect           @"UF_Router_Event_AddressSelect"
#define UF_Router_Event_ProductQuantity           @"UF_Router_Event_ProductQuantity"
#define UF_Router_Event_OrderPay                   @"UF_Router_Event_OrderPay"
#define UF_Router_Event_OrderSure                  @"UF_Router_Event_OrderSure"

#define UF_Notification_SwitchView                    @"UF_Notification_SwitchView"
#define UF_Notification_SwitchViewKey_Index           @"UF_Notification_SwitchViewKey_Index"


#define FUN_LOGIN                  0x10
#define FUN_LOGOUT                  0x11

#define kUserName_Password           @"username&password_ufan"
#define kPush           @"push_ufan"

#define kRootFolder    @"RootFolder_ufan"
#define kDataBaseFolder    @"DataBaseFolder_ufan"
#define kDataBaseName        @"UserInfo_ufan"
#define kAppDelegateFunction       @"AppDelegateFunction_ufan"
#define kHttpState       @"HttpState_ufan"
#define kHttpStateLoginSuccess       @"HttpStateLoginSuccess_ufan"
#define kHttpStateLogoutSuccess       @"HttpStateLogoutSuccess_ufan"


@interface QKUserData : NSObject

@property (nonatomic, strong) NSString *username;
@property (nonatomic, strong) NSString *password;

@end


@interface AppPublic : NSObject

+(AppPublic *)shareInstanceApp;

@property (strong, nonatomic) MainSlideVC *mainSlide;

@property (nonatomic) QKUserData *username_password;
@property (nonatomic) NSString *Token;                             //用户鉴权(单点登录)
@property (nonatomic) BOOL needRefreshOrderList;


@property (nonatomic) NSMutableDictionary *parseDic;
- (void)parseWithString:(NSString *)string;

- (void)clearUserData;

- (void)saveUserData:(NSString *)username password:(NSString *)password;



@property (nonatomic, assign) NSInteger mainViewIndexNow;           //主页面当前显示序数
@property (nonatomic, strong) MKMapView *showMapView;              //地图视图,本app所有VC均使用同一个地图视图
@property (nonatomic, strong) UFAddressInfo *addressSelected;      //当前选择的地址
@property (nonatomic, strong) UFPayStyle *payStyleSelected;      //当前选择的支付方式

+(void)doLogin;
+(void)doLogout;

- (void)adjustNavBar;
- (void)clearMapView;
- (void)presentLoginVC:(UIViewController *)sourceVC;

- (void)setPush:(BOOL)isPush;
- (BOOL)queryPush;


+(NSString *)filePath:(NSString *)folderName fileName:(NSString *)file;

+(NSString *)circleFilePath;             //html文件目录路径
+(NSString *)imgFilePath;             //img表情文件目录路径

NSDate *dateFromString(NSString *dateString);
NSString *stringFromDate(NSDate *date);
NSString *stringFromDateInHHmmss(NSDate *date);
NSDate *birthdayFromString(NSString *dateString);
NSString *stringFromBirthday(NSDate *date);
NSString *stringFromNextDay(NSDate *date);

NSString *httpRespString(NSError *error, NSObject *object);
NSString *starMiddle(NSString *string);
NSString *sha1(NSString *string);
BOOL isFirstUsing();//检查该版本是否第一次使用

@end


